<%= form_for @admin, :url => url_for(:controller => 'administrators', :action => @action) do |f| %>
<div class="panel panel-default" id="collapsed_tabs">
  <div class="panel-body">
    <div  class="tab-wrapper tab-left ">
      <ul class="nav nav-tabs">
        <li class="active tooltipState" data-toggle="tooltip" data-placement="right" data-title="<%= t("generic.profile") %>">
          <a href="#general" data-toggle="tab">
            <i class="fa fa-user"></i>
          </a>
        </li>
      </ul>
      <div class="tab-content">
        <%= render :partial => 'roroacms/admin/partials/submit_bar', :locals => { admin_record: @admin }  %>
        <div class="tab-pane active" id="general">

          <% if !@admin.id.blank? %>

            <div class="well well-background" style="background-image: url('<%= @admin.cover_picture %>');">
              <center>
                <div class="imr-wrapper">
                  <% if @admin.avatar.blank? %>
                    <%= image_tag("roroacms/default-profile.jpg", size: "140", class: "img-circle") %>
                  <% else %>
                    <img src="<%= @admin.avatar %>" name="aboutme" width="140" height="140" class="img-circle">
                  <% end %>
                  <span></span>
                </div>
                <h3><%= @admin.username %></h3>
                <% if !@admin.first_name.blank? %>
                  <small><%= @admin.first_name + ' ' + @admin.last_name %></small>
                <% end %>
              </center>

              <%= render partial: 'roroacms/admin/partials/cover_image', locals: { image: @admin.cover_picture } %>
              <%= f.file_field :cover_picture, :class => "", :id => "cover_image" %>
            </div>

          <% else %>

            <div class="well well-background">
              <center>
                <%= image_tag("roroacms/default-profile.jpg", size: "140", class: "img-circle") %>
              </center>
              <a style="margin:10px;" class="btn btn-xs btn-primary pull-right add-profile-image" href="javascript:;"><span class="fa fa-picture-o"></span> <%= t("views.admin.generic.change_cover") %></a>
              <a class="btn btn-xs btn-danger pull-right remove-profile-image hidden" href="javascript:;"><span class="fa fa-trash-o"></span> <%= t("views.admin.administrators.form.remove_cover") %></a>
              <%= hidden_field_tag :has_cover_image, ""  %>
              <%= f.file_field :cover_picture, :class => "" %>
            </div>

          <% end %>

          <div class="form-group">
            <%= f.label :first_name, :class => "col-sm-3 control-label"  %>
            <div class="col-sm-6">
              <%= f.text_field :first_name, size: 40, :class => "form-control" %>
            </div>
            <div class="clearfix"></div>
          </div>
          <div class="form-group">
            <%= f.label :last_name, :class => "col-sm-3 control-label"  %>
            <div class="col-sm-6">
              <%= f.text_field :last_name, size: 40, :class => "form-control" %>
            </div>
            <div class="clearfix"></div>
          </div>
          <div class="form-group">
            <%= f.label :email, :class => "col-sm-3 control-label"  %>
            <div class="col-sm-6">
              <%= f.text_field :email, size: 40, :class => "form-control" %>
              <%= errors_for @admin, :email %>
            </div>
            <div class="clearfix"></div>
          </div>
          <div class="form-group">
            <%= f.label :username, :class => "col-sm-3 control-label"  %>
            <div class="col-sm-6">
              <%= f.text_field :username, size: 40, :class => "form-control" %>
              <%= errors_for @admin, :username %>
            </div>
            <div class="clearfix"></div>
          </div>
          <div class="form-group">
            <%= f.label :avatar, :class => "col-sm-3 control-label"  %>
            <div class="col-sm-6">
              <span class="file-input btn btn-primary btn-file btn-sm">
                <%= t("views.admin.generic.browse") %><%= f.file_field :avatar, :class => "" %>
              </span>
              <small><%= t("views.admin.administrators.form.ideal_size") %></small>
            </div>
            <div class="clearfix"></div>
          </div>

          <% if (is_overlord? || @admin.id == nil)  && @admin.id != current_user.id %>

            <div class="form-group">
              <%= f.label :access_level, :class => "col-sm-3 control-label"  %>
              <div class="col-sm-6">
                <%= f.select :access_level, Roroacms::Admin.access_levels,  { prompt: t("views.admin.administrators.form.select_access_level") }, { class: "form-control" } %>
                <%= errors_for @admin, :access_level %>
              </div>
              <div class="clearfix"></div>
            </div>

          <% end %>

          <div class="form-group">
            <%= f.label :description, :class => "col-sm-3 control-label"  %>
            <div class="col-sm-6">
              <%= f.text_area :description, :class => "form-control" %>
            </div>
            <div class="clearfix"></div>
          </div>

          <div class="form-group">
            <%= f.label :password, :class => "col-sm-3 control-label"  %>
            <div class="col-sm-6">
              <%= f.password_field :password, :class => "form-control" %>
              <%= errors_for @admin, :password %>
            </div>
            <div class="clearfix"></div>
          </div>

          <div class="form-group">
            <%= f.label :password_confirmation, :class => "col-sm-3 control-label"  %>
            <div class="col-sm-6">
              <%= f.password_field :password_confirmation, :class => "form-control" %>
              <%= errors_for @admin, :password_confirmation %>
            </div>
            <div class="clearfix"></div>
          </div>

        </div>
      </div>
    </div>
  </div>
<% end %>